/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yy.bugzilla.desk;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

/**
 *
 * @author Alan
 */
public class MainApp extends Application {

    private WelcomePane welcomePane = new WelcomePane(this);
    private MainTabPane mainTabPane = new MainTabPane();
    private MainMenu mainMenu = new MainMenu(this);

    public MainTabPane getMainTabPane() {
        return mainTabPane;
    }

    @Override
    public void start(Stage primaryStage) {
        Scene scene = new Scene(initContextPane(), 800, 600);

        primaryStage.setTitle("Bugzilla Desk Management");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }

    private BorderPane initContextPane() {
        BorderPane bpTree = new BorderPane();
        Parent treePane = new ServerListPane(this).getContextPane();
        BorderPane.setMargin(treePane, new Insets(2, 2, 2, 2));
        bpTree.setCenter(treePane);
        bpTree.setRight(new ArrowPane(bpTree, treePane).getContextPane());

        BorderPane borderPane = new BorderPane();
        borderPane.setTop(mainMenu.getMenuBar());
        borderPane.setCenter(mainTabPane);
        borderPane.setLeft(bpTree);

        mainTabPane.addTab(WelcomePane.WELCOME, welcomePane.getContextPane(), true);
        return borderPane;
    }
}
